<template>
  <div class="app-container">
  <div class="filter-container">
        <el-button type="primary" @click="refreshClick()">刷新</el-button>
        
    </div>
    <el-table v-loading="listLoading" :data="list" 
      border fit highlight-current-row stripe 
      style="width: 100%">
      <el-table-column align="center" label="序" width="80">
        <template slot-scope="scope">
          <span>{{ scope.row._id }}</span>
        </template>
      </el-table-column>
     <el-table-column  min-width="100" align="center" label="工单号码">
        <template slot-scope="scope">
          <span>{{ scope.row.ordernumber }}</span>
        </template>
      </el-table-column>
      <el-table-column  min-width="100" align="center" label="出单日期">
        <template slot-scope="scope">
          <span>{{ scope.row.createtime }}</span>
        </template>
      </el-table-column>
      <el-table-column  min-width="100" align="center" label="类型">
        <template slot-scope="scope">
          <span>{{ scope.row.ordertype }}</span>
        </template>
      </el-table-column>
      <el-table-column  min-width="100" align="center" label="精品名称">
        <template slot-scope="scope">
          <span>{{ scope.row.boutiquename }}</span>
        </template>
      </el-table-column>
      <el-table-column  min-width="100" align="center" label="数量">
        <template slot-scope="scope">
          <span>{{ scope.row.boutiquecount }}</span>
        </template>
      </el-table-column>
      <el-table-column  min-width="100" align="center" label="实收总计">
        <template slot-scope="scope">
          <span>{{ scope.row.actualmoney }}</span>
        </template>
      </el-table-column>
      <el-table-column  min-width="100" align="center" label="制单人">
        <template slot-scope="scope">
          <span>{{ scope.row.guider }}</span>
        </template>
      </el-table-column>

    </el-table>

    <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.rows" @pagination="fetchData" />


  </div>
</template>

<script>
import * as carmanageApi from '@/api/aftersale/carmanage'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import * as enumHelper from '@/utils/enum'

export default {
    name:'carlist2',
    components: { Pagination },
    data(){
        return{
          search:{ 
              number:'',
              customer:'',
              phone:'',
              daterange:'',
          },
          listQuery: {
                page: 1,
                rows: 20,
                name:'',
                phone:'',
                state:-1,
                daterange:''
          },
          list:null,
          listLoading:false,
          total:0,
          
          
        }
    },
    created(){
        var that=this;
        //初始化下拉菜单
        //enumHelper.initOptions(that.selectOptions.salesState,enumHelper.presale.salesState);
        that.fetchData();
    },
    filters:{
      parseHandingType(val){
        return ['无','已办理','未办理'][val];
      },
      parsePayType(val){
        return enumHelper.presale.payType.getName(val);
      },
      parseSalesState(val){
        return enumHelper.presale.salesState.getName(val);
      }

    },
    methods:{
        fetchData(){
          var that=this;
            carmanageApi.getExtrapartsList({}).then(res=>{
              if(res.data){
                that.list=[...res.data.items.map((item,index)=>{
                  item._id=index+1;
                  return item;
                })];
              }
            })
        },
        refreshClick(){
          this.fetchData();
        },
        
        
    }
}
</script>

<style scoped>

</style>